Dynomotion

Group: DynoMotion Message: 11889 From: Hardy Family Date: 7/13/2015
Subject: Puzzled about setting command results
I don't understand something about KMotionCNC:  with PC commands sent from the Kflop, such as changing the tool length table entry, the following code in kmotioncncdlg.cpp is run to set the command result:

 
int CKMotionCNCDlg::SetKFLOPCommandResult(int r)
{
    CString s;
 
    MainStatus.PC_comm[0]=0;  // clear the command now that it has been executed
    s.Format("SetPersistDec%d %d",PC_COMM_PERSIST,r);
    if (TheFrame->KMotionDLL->WriteLine(s)) return 1;
    return 0;
}


However, the caller in CKMotionCNCDlg::ServiceKFLOPCommands() often calls this with a positive error code.  The code running on the kflop is something like:

int DoPC(int cmd)
{
   int result;
   
   persist.UserData[PC_COMM_PERSIST]=cmd;
   
   do
   {
      WaitNextTimeSlice();   
   }while (result=persist.UserData[PC_COMM_PERSIST]>0);
   
   return result;
}


which will loop forever if there is a +ve result code.

Another thing I noticed in CKMotionCNCDlg::ServiceKFLOPCommands: when setting the tool offsets/diamter etc., it checks the index to make sure it is 0..127, but in getting the value it checks for 0..99.  Maybe those values should be a sizeof() expression.

Regards,
SJH


Group: DynoMotion Message: 11891 From: Tom Kerekes Date: 7/13/2015
Subject: Re: Puzzled about setting command results
Hi SJH,

I think you are correct we will change those to be negative error codes so the KFLOP routine returns rather than hanging. 

Regarding tool table index - we changed the tests to be all 0-99 based on the 2 digit slot number limitation and the 100 tool limit for the Tool Table Dialog Screen

Thanks
TK

Group: DynoMotion Message: 11899 From: Hardy Family Date: 7/14/2015
Subject: Re: Puzzled about setting command results


On Mon, Jul 13, 2015 at 3:35 PM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

Hi SJH,

I think you are correct we will change those to be negative error codes so the KFLOP routine returns rather than hanging. 

Regarding tool table index - we changed the tests to be all 0-99 based on the 2 digit slot number limitation and the 100 tool limit for the Tool Table Dialog Screen

I wasn't complaining about the 100 limit, it's just that in the 433L version at least, some of the tests still refer to a 128 upper bound.  It's unlikely to cause a problem in practice, but while you're in there you may as well make it consistent.

Regards,
SJH

 

Thanks
TK

Group: DynoMotion Message: 11900 From: Tom Kerekes Date: 7/14/2015
Subject: Re: Puzzled about setting command results
Hi SJH,

Agreed.  They should be all consistent at 100 in the next release.

Thanks
TK